import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
import AppGrid from './components/app-grid'
import { Send } from 'lucide-react'
import { Header } from '@/components/header'
import { AppItemData } from './components/app-item'
import { useCookieState } from 'ahooks'
import { useState } from 'react'
import { ResetPasswordDialog } from './components/reset-password'

export default function WorkBenchView() {
  const [accessCode] = useCookieState('accessCode')

  const [isShowResetPasswordDialog, setIsShowResetPasswordDialog] =
    useState(false)

  const exampleApps: AppItemData[] = [
    {
      icon: <Send />,
      title: '入口一',
      desc: '入口一',
      link: `https://one.sxccdzzcpt.cn/ebidding/#/mine/mine?access_code=${accessCode}`,
    },
    {
      icon: <Send />,
      title: '入口二',
      desc: '入口二',
      link: `https://two.sxccdzzcpt.cn/bidweb?access_code=${accessCode}`,
    },
    {
      icon: <Send />,
      title: '简易采购（限额以下）',
      desc: '简易采购（限额以下）',
      link: `https://easy.sxccdzzcpt.cn/bidweb/?access_code=${accessCode}`,
    },
    {
      icon: <Send />,
      title: '供应商库系统',
      desc: '供应商库系统',
      link: `https://www.sxccdzzcpt.cn/register/registerForm?access_code=${accessCode}`,
    },
    {
      icon: <Send />,
      title: '专家调度',
      desc: '专家调度',
      link: `https://172.16.175.161/expert/clientContent/project?access_code=${accessCode}`,
    },
    {
      icon: <Send />,
      title: '专家库企业端',
      desc: '专家库企业端',
      link: `https://zjk.sxccdzzcpt.cn/login_token?access_code=${accessCode}`,
    },
    {
      icon: <Send />,
      title: '组织架构管理',
      desc: '组织架构管理',
      link: `https://new.sxccdzzcpt.cn/tissue/home?access_code=${accessCode}`,
    },
    {
      icon: <Send />,
      title: '专家评审费管理',
      desc: '专家评审费管理',
      link: `https://172.16.67.121/labor/SuppliersList/LaborList?access_code=${accessCode}`,
    },
  ]

  return (
    <>
      <div className='flex flex-col h-screen'>
        <div className='flex-none'>
          <Header title='工作台' />
        </div>
        <div className='flex-auto p-3 flex flex-col'>
          <Tabs defaultValue='1' className='flex flex-col'>
            <div className='flex-none flex items-center justify-between'>
              <TabsList>
                <TabsTrigger value='1'>常用应用</TabsTrigger>
              </TabsList>
            </div>
            <TabsContent value='1' className='flex-auto mt-3'>
              <AppGrid items={exampleApps} />
            </TabsContent>
          </Tabs>
        </div>
      </div>
      <ResetPasswordDialog
        open={isShowResetPasswordDialog}
        onOpenChange={setIsShowResetPasswordDialog}
      />
    </>
  )
}
